<?php
/**
 * Yii console bootstrap file.
 *
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

//加载项目环境文件
ini_set('date.timezone', 'PRC');
define('YII_ENV_APP_NAME', 'goods.yaochufa.com');
define('DS', DIRECTORY_SEPARATOR);

define('APP_PATH', __DIR__);
define('TIMESTAMP', time());
define('YCF_CONFIG_PATH', APP_PATH . DS . '..' . DS . 'ycf_config' . DS . YII_ENV_APP_NAME);

$configFile = APP_PATH . DS . '..' . DS . 'ycf_config' . DS . YII_ENV_APP_NAME . DS . 'console.php';

if (!file_exists($configFile)) {
    die('config file is not exist!');
}

$config = require $configFile;

if (!$config) {
    die('can not load config');
}

require APP_PATH . DS . 'vendor' . DS . 'autoload.php';
require APP_PATH . DS . 'vendor' . DS . 'yiisoft' . DS . 'yii2' . DS . 'Yii.php';

$application = new yii\console\Application($config);
$exitCode    = $application->run();
exit($exitCode);

// $route  = 'hello/index';
// $params = [['a' => ['sdfsdf']], ['b' => ['sdfsdf', 'sdfsdf']]];

// try {
//     $exitCode = $application->runAction($route, $params);
// } catch (Exception $e) {
//     var_dump($e->getMessage());
// }
